//
//  VideoMenuViewController.m
//  Dayou
//
//  Created by mac on 2018/8/14.
//  Copyright © 2018年 YangYang. All rights reserved.
//

#import "VideoMenuViewController.h"

#import "NormalVideoViewController.h"
#import "NotAutoPlayListViewController.h"
#import "AutoPlayListViewController.h"
#import "SmallPlayViewController.h"

@interface VideoMenuViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *dataSource;

@end

@implementation VideoMenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createTable];
}

-(void)createTable
{
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight) style:UITableViewStylePlain];
    [self.view addSubview:_tableView];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.tableFooterView = [UIView new];
    
}

#pragma mark - ----------------------UITableViewDataSource----------------------
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataSource.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"UITableViewCell"];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (self.dataSource.count > indexPath.row) {
        NSDictionary *dic = self.dataSource[indexPath.row];
        cell.textLabel.text = dic[@"title"];
        cell.detailTextLabel.text = dic[@"content"];
    }
    return cell;
}

#pragma mark - ----------------------UITableViewDelegate----------------------
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.row) {
        case 0:
        {//键盘支持横屏
            
        }
            break;
        case 1:
        {//普通样式
            NormalVideoViewController *normalVideoVC = [[NormalVideoViewController alloc] init];
            normalVideoVC.navigationItem.title = @"普通样式";
            [self.navigationController pushViewController:normalVideoVC animated:YES];
        }
            break;
        case 2:
        {//列表点击播放
            NotAutoPlayListViewController *notAutoPlayListVC = [[NotAutoPlayListViewController alloc] init];
            notAutoPlayListVC.navigationItem.title = @"列表点击播放";
            [self.navigationController pushViewController:notAutoPlayListVC animated:YES];
        }
            break;
        case 3:
        {//列表自动播放
            AutoPlayListViewController *autoPlayListVC = [[AutoPlayListViewController alloc] init];
            autoPlayListVC.navigationItem.title = @"列表自动播放";
            [self.navigationController pushViewController:autoPlayListVC animated:YES];
        }
            break;
        case 4:
        {//列表小窗播放
            SmallPlayViewController *smallPlayVC = [[SmallPlayViewController alloc] init];
            smallPlayVC.navigationItem.title = @"列表小窗自动播放";
            [self.navigationController pushViewController:smallPlayVC animated:YES];
        }
            break;
        case 5:
        {//列表明暗播放
            
        }
            break;
        case 6:
        {//多种cell混合样式
            
        }
            break;
        case 7:
        {//抖音样式
            
        }
            break;
        case 8:
        {//CollectionView
            
        }
            break;
        case 9:
        {//瀑布流
            
        }
            break;
            
        default:
            break;
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}

-(NSArray *)dataSource
{
    if (!_dataSource) {
        _dataSource = @[
                        @{@"title":@"键盘支持横屏",@"content":@""},
                        @{@"title":@"普通样式",@"content":@"已完成"},
                        @{@"title":@"列表点击播放",@"content":@"已完成"},
                        @{@"title":@"列表自动播放",@"content":@"已完成"},
                        @{@"title":@"列表小窗播放",@"content":@"已完成"},
                        @{@"title":@"列表明暗播放",@"content":@""},
                        @{@"title":@"多种cell混合样式",@"content":@""},
                        @{@"title":@"抖音样式",@"content":@""},
                        @{@"title":@"CollectionView",@"content":@""},
                        @{@"title":@"瀑布流",@"content":@""},];
    }
    return _dataSource;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
